#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>

// 若某一位1的个数不是k的倍数，则无法实现题述操作。若所有位1的个数均为k的倍数，则可行。

using namespace std;

const int N = 31;
int n;
int cnt[31];
int kkk[31];


vector<int> sol(){
    vector<int> res;
    bool fst = true;
    for (int i = 1; i <= n; i ++){
        fst = true;
        for (int j = 0; j < 31; j++){
            if(cnt[j] % i != 0){
                fst = false;
            }
        }
        if(fst){
            res.push_back(i);
        }
    }
        return res;
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);


    int T;
    int x;

    cin >> T;
    while(T--){
        cin >> n;
        memset(cnt, 0, sizeof cnt);
        bool flag = true;
        for (int i = 0; i < n; i ++){
            cin >> x;
            if(x != 0){
                flag = false;
            }
            int index = 0;
            while(x){
                if(x & 1){
                    cnt[index]++;
                }

                index++;
                x >>= 1;
            }
        }


        if(flag){
            for (int i = 1; i <= n; i ++){
                cout << i << " ";
            }
            cout << endl;
        }else{
            vector<int> res = sol();
            for (int i = 0; i < res.size(); i ++){
                cout << res[i] << " ";
            }
            cout << endl;
        }

        


    }
    return 0;
}   